<template>
	<List :listDatas="listDatas">
		<template v-slot="{ item }">
			<view class="coupon">
				<view class="coupon-left">
					<view class="f-w">
						<block v-if="item.couponScope == '1'">
							{{item.couponName}}
						</block>
						<block v-else-if="item.couponScope == '2'">
							<view class="flex">
								<!-- <view class="profile-tenant"> -->
								<!-- <sl-image :value="item.tenantHeadimg"></sl-image> -->
								<!-- </view> -->
								{{item.tenantName}}
							</view>
						</block>
					</view>
					<view class="f-24 f-tip py-1">
						{{item.limitDesc}}
					</view>
					<view class="f-24 f-tip p-a bottom-0">
						{{item.expireDesc}}
					</view>
				</view>
				<view class="coupon-right">
					<view class="right-block">
						<view class="block-price">
							<block v-if="item.couponType == '0'">
								-<Money :priceValue="item.val" :activeClass="['money-price','money-price-white']"></Money>
							</block>
							<block v-else-if="item.couponType == '1'">
								{{item.val}}折
							</block>
						</view>
						<view class="block-scope oneline-hide">
							{{item.scopeDesc}}
						</view>
						<view class="block-use" @click="toTargetTenant(item.tenantId)">
							使用
						</view>
					</view>
				</view>
				<slot :coupon="item"></slot>
			</view>
		</template>
	</List>
</template>

<script>
	import CouponApi from '@/api/coupon/coupon.js';
	import Constants from '@/constants';
	import Money from '@/pages/components/money/money.vue';
	import List from '@/pages/components/list/list.vue';
	//优惠券组件（非领券中心）
	//@group 业务组件
	export default {
		//
		name: 'couponUse',
		//
		mixins: [Constants],
		//
		components: {
			List,
			Money,
			
		},
		//
		data() {
			return {};
		},
		//
		props: {
			//优惠券集合
			listDatas: {
				type: Array,
				default () {
					return [];
				}
			}
		},
		//
		methods: {
			//
			toTargetTenant(id) {
				this.$app.navTo(this.pages.goodsTenantPage, {
					tenantId: id
				});
			},
		}
	};
</script>

<style lang="scss" scoped>
	.coupon {
		font-size: $uni-font-size-base;
		height: 188rpx;
		position: relative;
		display: flex;
		justify-content: space-between;

		.coupon-left {
			font-size: $uni-font-size-lg;
			flex:1;
			padding: 16rpx 38rpx;

			// .profile-tenant {
			// 	position: relative;
			// 	width: 52rpx;
			// 	height: 52rpx;
			// 	margin-right: 16rpx;
			// }
		}

		.coupon-right {
			display: flex;
			align-items: center;

			.right-block {
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				width: 115px;
				height: 92px;
				border-radius: 8px;
				background: linear-gradient(135deg, #FFC28A 0.01%, #FF2323 100%);
				padding: 10rpx;
				.block-price {
					color: $uni-text-color-inverse;
					text-align: center;
					font-size: 40rpx;
					font-weight: 700;
					line-height: 44rpx;
					margin-top: 8rpx;
					display: flex;
				}

				.block-scope {
					color: $uni-text-color-inverse;
					text-align: center;
					font-size: 20rpx;
					line-height: 44rpx;
				}

				.block-use {
					display: flex;
					padding: 4rpx 16rpx;
					justify-content: center;
					align-items: center;
					border-radius: 76rpx;
					border: 0.5px solid $uni-text-color-inverse;
					color: $uni-text-color-inverse;
					font-weight: 500;
					width: 140rpx;
				}

			}
		}
	}
</style>